package service.functions;

import javax.xml.bind.annotation.XmlElement;

/**
 * Created with IntelliJ IDEA.
 * User: Claudio "Dna" Bonesana
 * Date: 16.04.13
 * Time: 17:59
 */

public class FunctionService {

    private String name;
    private FunctionValue value;

    public String getName() {
        return name;
    }

    @XmlElement(name = "Name")
    public void setName(String name) {
        this.name = name;
    }

    public FunctionValue getValue() {
        return value;
    }

    @XmlElement(name = "Value")
    public void setValue(FunctionValue value) {
        this.value = value;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("FUNCT: " + name + " -> ");

        String str;
        if ((str = value.getIp()) != null){
            sb.append(str);
        }
        if ((str = value.getPlace()) != null){
            sb.append(str);
        }
        if ((str = value.getLatitude()) != null){
            sb.append(str + " ");
        }
        if ((str = value.getLongitude()) != null){
            sb.append(str);
        }
        return sb.toString();
    }

}
